package com.lxy.cxcyxmmsbackend.sys.controller;


import com.lxy.cxcyxmmsbackend.sys.req.RidPidReq;
import com.lxy.cxcyxmmsbackend.sys.res.Result;
import com.lxy.cxcyxmmsbackend.sys.service.PermissionService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 权限管理
 * @author 刘新颖
 * @since 2024-01-07
 */
@Api(tags = "权限")
@RestController
@RequestMapping("permission")
@CrossOrigin("*")
public class PermissionController {
    @Resource
    PermissionService permissionService;

    @RequestMapping("selectAllPermission")
    public Result selectAllPermission(){
        return permissionService.selectAllPermission();
    }

    @RequestMapping("selectMIdByRId/{roleBh}")
    public Result selectMIdByRId(@PathVariable("roleBh")String roleBh){
        return permissionService.selectMIdByRId(roleBh);
    }

    @RequestMapping("selectMIdAIdByRId/{roleBh}")
    public Result selectMIdAIdByRId(@PathVariable("roleBh")String roleBh){
        return permissionService.selectMIdAIdByRId(roleBh);
    }

    @RequestMapping("empowered") //赋权
    public Result empowered(@RequestBody RidPidReq req){
        return permissionService.empowered(req.getRoleBh(), req.getPerBh());
    }


}
